#ifndef _SYSCALLS_H_
#define _SYSCALLS_H_

#include <td.h>
#include <sched.h>

// Send syscall errors
#define ERROR_INVALID_TID					-1
#define	ERROR_TX_INCOMPLETE				-2

// Receive syscall errors
#define ERROR_MSG_TRUNCATED				-1

// Reply syscall errors
#define ERROR_NOT_REPLY_BLOCK			-2
#define ERROR_NOT_ENOUGH_SPACE		-3

// AwaitEvent syscall errors
#define ERROR_INVALID_EVENTID     -1

// TODO: Move to its own file
int Min(int a, int b);

int SysCreate( sched *s, td *task, int priority, void (*func) () );
int SysMyTid( sched *s, td *task );
int SysMyParentTid( sched *s, td *task );
void SysPass( sched *s, td *task );
void SysExit( sched *s, td *task );
void SysFingerOfDeath( sched *s, td *task );
int SysSend( sched *s, td *task, int tid, char *msg, int msglen, char *reply, int replylen );
int SysReceive(sched *s, td *task, int *tid, char *msg, int len);
int SysReply(sched *s, td *task, int tid, char *reply, int len);
int SysAwaitEvent(sched *s, td *task, int eventid, char *event, int eventlen);

#endif
